#include "stdafx.h"
#include "EndianCast.h"

bool IsBigEndian()
{
    short word = 0x4321;
    if((*(char *)& word) != 0x21 )
        return true;
    else 
        return false;
}

uint64 htonll(uint64 x) {
    uint64 retval;
    if (IsBigEndian())
        retval = x;
    else
    {
        retval = (((uint64)(ntohl((int32)((x << 32) >> 32))) << 32) | (uint32)ntohl(((int32)(x >> 32))));
    }

    return(retval);
}
